package cn.com.zcode.exam.service;

import java.util.List;
import java.util.Map;

import cn.com.zcode.core.service.BaseService;
import cn.com.zcode.exam.model.Answer;
import cn.com.zcode.exam.model.Examination;
import cn.com.zcode.exam.model.Paper;
import cn.com.zcode.exam.model.Question;
import cn.com.zcode.exam.model.StaticInfo;
import cn.com.zcode.exam.model.Wrong;
import cn.com.zcode.user.model.User;

public interface ExamService extends BaseService {

	public Question addQuestion(Question question);

	public List<Question> findQuestions(String key);

	public Paper getPaper(String string);

	public Paper mergePaper(Paper paper);

	public Paper addPaper(Paper paper);

	public Answer addAnswer(Answer answer);

	public Wrong addWrong(Wrong wrong);

	public List<Paper> findPapers(String key, String userid);

	public Wrong getWrong(String userId, String questionId);

	public List<StaticInfo> getStatinfo(String string);

	public List<Question> findWrongQuestions(String type, String userId);

	public Paper getPaper(String type, String title, int state, String userid);

	public List<StaticInfo> getPaperInfo(String type);

	public List<Question> searchQuestions(String keyword, String userId);

	public Question getQuestion(String id);

	public Question updateQuestion(Question question);

	public List<Examination> findExamination(String string, String id);

	public List<Question> findNewExamQuestions(String pid);

	public List<Question> findLastExamQuestions(String eid);

	/**
	 * 通过类型查找试卷
	 * 
	 * @param string
	 * @param user
	 * @return
	 */
	public List<Paper> findPaperByUser(String type, User user);

	/**
	 * 获取最后一次答题的试卷
	 * 
	 * @param paperId
	 * @param userId
	 * @return
	 */
	public Examination getLastExamination(String paperId, String userId);

	/**
	 * 查找可以修改的PAPER
	 * 
	 * @param type
	 * @param user
	 * @return
	 */
	public List<Paper> findEditablePaper(String type, User user);

	/**
	 * 考试中分次加载问题
	 * 
	 * @param eid
	 * @param isForWrong
	 * @param start
	 *            开始题号
	 * @param unsubmitId
	 *            数量
	 * @return
	 */

	public List<Question> findRemainingQuestions(String eid, boolean isForWrong, int length, String out);

	/**
	 * 保存默认的PAPER《我的错题》
	 * 
	 * @param user
	 */
	public void saveWrongPaper(User user);

	/**
	 * 计算分数，结束考试
	 * 
	 * @param eid
	 * @return
	 */
	public Examination saveFinishExamination(String eid);

	/**
	 * 开始但页面，初始化试着对象
	 * 
	 * @param user
	 * @param paperId
	 * @param continueExam
	 * @return
	 */
	public Examination getStartExamination(User user, String paperId, boolean continueExam);

}